//
//  BCOrderFirstCollectionViewCell.m
//  BangcaiBuy
//
//  Created by Liang Zhang on 16/6/14.
//  Copyright © 2016年 BCB. All rights reserved.
//

#import "BCOrderFirstCollectionViewCell.h"

@interface BCOrderFirstCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIButton *decButton;
@property (weak, nonatomic) IBOutlet UIButton *addButton;

@end

@implementation BCOrderFirstCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.decButton.layer.cornerRadius = self.decButton.frame.size.height/2;
    self.addButton.layer.cornerRadius = self.addButton.frame.size.height/2;
}

+ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView {
    static NSString *ID = @"FirstCell";
    UINib *nib = [UINib nibWithNibName:@"BCOrderFirstCollectionViewCell" bundle: [NSBundle mainBundle]];
    [collectionView registerNib:nib forCellWithReuseIdentifier:ID];
    BCOrderFirstCollectionViewCell *cell = [[BCOrderFirstCollectionViewCell alloc] init];
    return cell;
}

- (IBAction)decCount:(id)sender {
    if (self.countLable.text.integerValue > 1) {
        NSInteger count = self.countLable.text.integerValue - 1;
        self.countLable.text = [NSString stringWithFormat:@"%@",@(count)];
    }
    [[BCShopCarManager sharedInstance] removeStuffName:@"培根" amount:1 price:2500.0 type:0];
    
    
}

- (IBAction)addCount:(id)sender {
    if (self.countLable.text.integerValue < 100) {
        NSInteger count = self.countLable.text.integerValue + 1;
        self.countLable.text = [NSString stringWithFormat:@"%@",@(count)];
    
     [[BCShopCarManager sharedInstance] addStuffName:@"培根" amount:1 price:2500.0 type:0];
       

    
}
}

@end
